using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class MainScript : MonoBehaviour
{
    private Book book;
    
	// Use this for initialization
	void Start ()
    {
        GameObject bookPrefab = (GameObject)Instantiate(Resources.Load("bookPrefab"));
        book = bookPrefab.GetComponent<Book>();
	}
	
	// Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Keypad4))
        {
            book.turnLeft();
        }
        else if (Input.GetKeyDown(KeyCode.Keypad6))
        {
            book.turnRight();
        }
        else if (Input.GetKeyDown(KeyCode.Tab))
        {
            book.switchCurrentPage();
        }
        else if (Input.GetKeyDown(KeyCode.Return))
        {
            Page currentPage = book.getCurrentPage();
            currentPage.addCutPatch();
        }
        else if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            CutPatch cutPatch = book.getCurrentPage().getCutPatch();

            if (cutPatch != null)
            {
                cutPatch.moveLeft();
            }
        }
        //else if (Input.GetKeyDown(KeyCode.RightArrow))
        //{
        //    CutPatch cutPatch = book.getCurrentPage().getCutPatch();

        //    if (cutPatch != null)
        //    {
        //        cutPatch.moveRight();
        //    }
        //}
        //else if (Input.GetKeyDown(KeyCode.LeftArrow))
        //{
        //    CutPatch cutPatch = book.getCurrentPage().getCutPatch();

        //    if (cutPatch != null)
        //    {
        //        cutPatch.moveLeft();
        //    }
        //}
        //else if (Input.GetKeyDown(KeyCode.LeftArrow))
        //{
        //    CutPatch cutPatch = book.getCurrentPage().getCutPatch();

        //    if (cutPatch != null)
        //    {
        //        cutPatch.moveLeft();
        //    }
        //}
    }

}
